﻿using System.Data;
using _1142063_1142080_1142098.Models.DTO;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace _1142063_1142080_1142098.Models.Services
{
    public class DanhMucService
    {
        public static List<DanhMuc> LayDanhSach(byte loaiDanhMuc)
        {
            var danhMucList = new List<DanhMuc>();
            var myDataProvider = new MyDataProvider();
            myDataProvider.Open();
            var parameterList = new List<SqlParameter>();
            parameterList.Add(new SqlParameter("@LoaiDanhMuc",SqlDbType.TinyInt));
            parameterList[parameterList.Count - 1].Value = loaiDanhMuc;
            danhMucList = Utility.ToList<DanhMuc>(myDataProvider.ExcuteQueryWithParameters("spu_danhMuc_layDanhSachTheoLoaiDanhMuc",parameterList));
            myDataProvider.Close();
            return danhMucList;
        }
    }
}